package com.zhong.learning.auto_paper.controller;

import com.our.learning.infrastructure.pojo.Response;
import com.zhong.learning.auto_paper.dto.AutoPaperDTO;
import com.zhong.learning.auto_paper.service.AutoPaperService;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhong
 * @date 2023/6/18
 */
@RestController
@RequestMapping("/auto_paper")
public class AutoPaperController {

    private final AutoPaperService autoPaperService;

    public AutoPaperController(AutoPaperService autoPaperService) {
        this.autoPaperService = autoPaperService;
    }

    @PostMapping
    public Response autoCompose(AutoPaperDTO autoPaperDto) {
        return autoPaperService.autoCompose(autoPaperDto);
    }

    @GetMapping("/{id}")
    public Response getPaperById(@PathVariable Integer id) {
        return autoPaperService.getPaperById(id);
    }

    @GetMapping("/list")
    public Response getAll() {
        return autoPaperService.getAll();
    }
}
